package com.application.chiettinhdienluc.adapter;


import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.application.chiettinhdienluc.ui.ImageGridActivity;
import com.application.chiettinhdienluc.ui.ImageGridActivity.ImageGridFragment;
import com.application.chiettinhdienluc.ui.KhachHangInfoFragment;
import com.application.chiettinhdienluc.ui.KhaosatInfoFragment;
import com.application.chiettinhdienluc.ui.NhanCongInfoFragmentActivity;
import com.application.chiettinhdienluc.ui.NhanCongInfoFragmentActivity.NhancongInfoFragment;
import com.application.chiettinhdienluc.ui.ResultInfoFragment;
import com.application.chiettinhdienluc.ui.VattuInfoFragmentActivity;
import com.application.chiettinhdienluc.ui.VattuInfoFragmentActivity.VattuInfoFragment;

public class MainFragmentPagerAdapter extends FragmentPagerAdapter{
	
	final int PAGE_COUNT = 6;
	
	public MainFragmentPagerAdapter(FragmentManager fm) {
		super(fm);
		
	}

	/** This method will be invoked when a page is requested to create */
	@Override
	public Fragment getItem(int arg0) {
		Bundle data = new Bundle();
		switch(arg0){
		
			/** Android tab is selected */
			case 0:
				KhachHangInfoFragment userinfo = new KhachHangInfoFragment();				
//				data.putInt("current_page", arg0+1);
//				userinfo.setArguments(data);
				return userinfo;
				
			case 1:
				KhaosatInfoFragment khaosat = new KhaosatInfoFragment();
//				data.putInt("current_page", arg0+1);
//				khaosat.setArguments(data);
				return khaosat;
				
			case 2:
				VattuInfoFragment vattu = new VattuInfoFragmentActivity.VattuInfoFragment();
//				data.putInt("current_page", arg0+1);
//				vattu.setArguments(data);
				return vattu;
				
			case 3:
				NhancongInfoFragment nhancong = new NhanCongInfoFragmentActivity.NhancongInfoFragment();
//				data.putInt("current_page", arg0+1);
//				nhancong.setArguments(data);
				return nhancong;
			case 4:
				ImageGridFragment imgGrid = new ImageGridActivity.ImageGridFragment();
//				data.putInt("current_page", arg0+1);
//				result.setArguments(data);
				return imgGrid;	
			case 5:
				ResultInfoFragment result = new ResultInfoFragment();
//				data.putInt("current_page", arg0+1);
//				result.setArguments(data);
				return result;	
		}
		
		return null;
	}

	/** Returns the number of pages */
	@Override
	public int getCount() {		
		return PAGE_COUNT;
	}
	
}
